Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GradedAxes] Simplify dual graded unit range slicing #1583

Merged
merged 5 commits into from
Nov 14, 2024

Conversation

ogauthe
Copy link
Contributor

@ogauthe ogauthe commented Nov 14, 2024

This PR simplifies blockedunitrange_getindices by calling nondual(a). It also add tests to check both axes and elements have been dualled.

The last case with indices::AbstractBlockVector{<:Block{1}} is slightly different as it outputs a vector of LabelledInteger while the other return vectors of LabelledUnitRangeDual.

As a side note, the important information about dual is in the axes of the BlockVector and not in its element. Therefore we may completely remove LabelledUnitRangeDual (and just take the element dual of a LabelledUnitRange) without affecting BlockSparseArray.

@mtfishman mtfishman changed the title Blockedunitrange nondual [GradedAxes] Blocked unit range nondual Nov 14, 2024
@mtfishman
Copy link
Member

Looks good, thanks! Nice to see this code get simplified.

As a side note, the important information about dual is in the axes of the BlockVector and not in its element. Therefore we may completely remove LabelledUnitRangeDual (and just take the element dual of a LabelledUnitRange) without affecting BlockSparseArray.

I was picturing it might be used to preserve dual information in operations like:

r = gradedrange([U1(0) => 2, U1(1) => 3])
a = BlockSparseArray{Float64}(r, dual(r))
axes(@view(a[Block(1, 1)])) # (LabelledUnitRange, LabelledUnitRangeDual)

But to me that is a good use case for having a SectorDual, so we can just use LabelledUnitRange with dual label instead of a devoted type LabelledUnitRangeDual.

@mtfishman mtfishman merged commit f4aa481 into ITensor:main Nov 14, 2024
12 checks passed
@mtfishman mtfishman changed the title [GradedAxes] Blocked unit range nondual [GradedAxes] Simplify dual graded unit range slicing Nov 14, 2024
@ogauthe ogauthe deleted the blockedunitrange_nondual branch November 14, 2024 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants